import request from '@/utils/request'

// 获取所有角色列表
export const getRoleListAPI = (params) => {
  return request({
    url: '/sys/role',
    params
  })
}

// 获取公司信息
export const getCompanyInfoAPI = (companyId) => {
  return request({
    url: `/company/${companyId}`,
  })
}

// 添加角色
export const addRoleAPI = (data) => {
  return request({
    method: 'POST',
    url: '/sys/role',
    data
  })
}

// 根据ID获取角色详情
export const getRoleDetailAPI = (rouleId) => {
  return request({
    url: `/sys/role/${rouleId}`,
  })
}

// 根据ID更新角色
export const updateRoleDetailAPI = (roleobj) => {
  console.log(roleobj)
  return request({
    method: 'PUT',
    url: `/sys/role/${roleobj.id}`,
    data: roleobj
  })
}

// 根据ID删除角色
export const deleteRoleDetailAPI = (roleId) => {
  return request({
    method: 'DELETE',
    url: `/sys/role/${roleId}`,
  })
}

// 给角色分配权限点
export const assignPremAPI = (data) => {
  return request({
    method: 'PUT',
    url: '/sys/role/assignPrem',
    data
  })
}
